package com.example.sprintboot.mapper;

import com.example.sprintboot.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from user where username=#{username}")
    User findByUserName(String username);

    @Insert("insert into user(username,password,email)" + " values(#{username},#{password},'')")
    void add(String username, String password);

    @Update("update user set avatar=#{avatar} where id=#{id}")
    void updateAvatar(Integer id, String avatar);

    @Select("select * from user where id=#{id}")
    User findById(Integer id);
}
